Lang.bind(this, this._onShowProcesses2));
this.mountOp.connect('aborted',
Lang.bind(this, this.close));
+ this.mountOp.connect('show-unmount-progress',
+ Lang.bind(this, this._onShowUnmountProgress));
this._gicon = source.get_icon();
},
this._dialog.close();
this._dialog = null;
}
+
+ if (this._notifier) {
+ this._notifier.done();
+ this._notifier = null;
+ }
},
_onShowProcesses2: function(op) {
this._processesDialog.update(message, processes, choices);
},
+ _onShowUnmountProgress: function(op, message, timeLeft, bytesLeft) {
+ if (!this._notifier)
+ this._notifier = new ShellUnmountNotifier();
+
+ if (bytesLeft == 0)
+ this._notifier.done(message);
+ else
+ this._notifier.show(message);
+ },
+
borrowDialog: function() {
if (this._dialogId != 0) {
this._dialog.disconnect(this._dialogId);
}
});
+const ShellUnmountNotifier = new Lang.Class({
+ Name: 'ShellUnmountNotifier',
+ Extends: MessageTray.Source,
+
+ _init: function() {
+ this.parent('', 'media-removable', St.IconType.FULLCOLOR);
+
+ this._notification = null;
+ Main.messageTray.add(this);
+ },
+
+ show: function(message) {
+ let [header, text] = message.split('\n', 2);
+
+ if (!this._notification) {
+ this._notification = new MessageTray.Notification(this, header, text);
+ this._notification.setTransient(true);
+ this._notification.setUrgency(MessageTray.Urgency.CRITICAL);
+ } else {
+ this._notification.update(header, text);
+ }
+
+ this.notify(this._notification);
+ },
+
+ done: function(message) {
+ if (this._notification) {
+ this._notification.destroy();
+ this._notification = null;
+ }
+
+ if (message) {
+ let notification = new MessageTray.Notification(this, message, null);
+ notification.setTransient(true);
+
+ this.notify(notification);
+ }
+ }
+});
+
const ShellMountQuestionDialog = new Lang.Class({
Name: 'ShellMountQuestionDialog',
Extends: ModalDialog.ModalDialog,